import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.WindowConstants; 
import javax.swing.SwingUtilities;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class Login extends javax.swing.JFrame implements ActionListener
{
	private JLabel jLabel1;
	private JButton Dirver;
	private JButton Controler;
	private JButton Passenger;

	/**
	 * Auto-generated main method to display this JFrame
	 */
	public static void main(String[] args)
	{
		database.openBusDatabase();
    SwingUtilities.invokeLater(new Runnable()
		{
			public void run()
			{
				Login inst = new Login();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}

	public Login()
	{
		super();
		initGUI();
	}

	private void initGUI()
	{
		try
		{
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				jLabel1 = new JLabel();
				BorderLayout jLabel1Layout = new BorderLayout();
				jLabel1.setLayout(jLabel1Layout);
				getContentPane().add(jLabel1, "Center");
				jLabel1.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
						"gmpte-logo.png")));
				jLabel1.setBounds(0, -66, 389, 359);
			}
			{
				Dirver = new JButton();
				BorderLayout DirverLayout = new BorderLayout();
				getContentPane().add(Dirver);
				Dirver.setLayout(null);
				Dirver.setText("Driver");
				Dirver.setBounds(-1, 232, 182, 22);
				Dirver.addActionListener(this);
			}
			{
				Controler = new JButton();
				getContentPane().add(Controler);
				Controler.setLayout(null);
				Controler.setText("Controler");
				Controler.setBounds(-1, 254, 182, 22);
				Controler.addActionListener(this);
			}
			{
				Passenger = new JButton();
				getContentPane().add(Passenger);
				Passenger.setLayout(null);
				Passenger.setText("Passenger");
				Passenger.setBounds(-1, 276, 182, 22);
				Passenger.addActionListener(this);
			}
			pack();
			this.setSize(182, 339);
		} catch (Exception e)
		{
			// add your error handling code here
			e.printStackTrace();
		}
	}

	public void actionPerformed(ActionEvent event)
	{
		if (event.getSource() == Dirver)
		{

			GUI driverInfo = new GUI();
			driverInfo.setVisible(true);

		}
		if (event.getSource() == Controler)
		{
          //new newCoutrolerPanel().setVisible(true);
          new controlerPanel().setVisible(true);
		}
		if (event.getSource() == Passenger)
		{
          new Passage().setVisible(true);
		}
	}

}
